
x = [1, 2, 3, 4, 5, 6]
# 查
print(x[1])
print(x[2:3])
print(1 in x)
# 改
x[1] = 99
print(x)
print(x * 3)
# 增
x.append(66)
x.append([11])
x.extend([9])
x.extend([1, 2])
x.insert(2, 2222)
print(x)
# 删
x.pop()
print(x)
x.pop(0)
print(x)
x.remove(2222)
# x.clear()
print(x)

# 其他用法
x = [3, 5, 1, 2]
x.sort()  # 升序
x.sort(reverse=True)  # 降序
print(x)
x.count(3)
print(tuple(x))  # 转换


list1 = [54, 6, 57, 5, 57, 7, 6, 7,22, 57, 57, 57, 436]
# 模拟index
try:
    for i in range(len(list1)):
        if 22 not in list1:
            raise Exception("没有找到")
        if list1[i] == 22:
            print(i)
except Exception as a:
    print(a)
